package org.zjt.review

/**
  * DESC    
  *
  * @author
  * @create 2017-06-20 下午4:39
  **/

class Father1(val name: String, private val addr: String, protected val age: Int) {
  override def toString: String = s"name:$name\taddr:$addr\tage:$age"
}

class Son(override val name: String, val addr: String, override val age: Int) extends Father1(name = name, addr = addr, age = age) {}


//protected 属性只能被子类竭诚
class Father2 {
  private[zjt] var name: String = null
  protected var age: Int = -1
  var addr: String = null

}


class Son2() extends Father2 {
  override def toString: String = s"addr:$addr\tage:$age"
}


object AccessSign extends App {
  var o = new Son("zhang", "beijing", 12)
  println(o toString)

  var o1 = new Son2()
  o1.addr = "beijing"
  o1.name = "zhangsan"
  println(o1 toString)
}
